import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import App from './App.vue'
import router from '@/router'
import { createPinia } from 'pinia';

import '@/assets/base.css'
import '@/assets/icon/iconfont.css'


const app = createApp(App)
const pinia = createPinia();

app.use(ElementPlus)
app.use(router)
app.use(pinia)
app.mount('#app')




import {useConfigStore} from '@/stores/config'

const configStore = useConfigStore();
window.api.onStdoutLog((event, data) => {
    data = data.replace(/\x1b\[[0-9;]*m/g, '');
    data = data.replace(/\n+/g, '\n');
    configStore.setStdoutLog("vitepress", "#fefefe", data);
});


window.api.onServiceClose((enent, code)=>{
    if (code==1){
        configStore.setRunningFlag(false);
        configStore.setStdoutLog("vitepress", "#e24050", "服务已关闭");
    }
});
